package bean.dao;

import hbt.HibernateUtil;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import bean.model.ListaPrecios;


public class HibernateListaPreciosDAO {
	private static HibernateListaPreciosDAO instancia = null;
	private static SessionFactory sf = null;

	public static HibernateListaPreciosDAO getInstancia(){
		if(instancia == null){
			sf = HibernateUtil.getSessionFactory();
			instancia = new HibernateListaPreciosDAO();
		} 
		return instancia;
	}
	
	public void grabarListaPrecios(ListaPrecios listaPrecios){
		Session session = sf.openSession();
		session.beginTransaction();
		session.persist(listaPrecios);
		session.flush();
		session.getTransaction().commit();
		session.close();
	}
}
